<html>
<head><meta charset="utf-8"><title>rust-analyzer does not work on most of libcore · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html">rust-analyzer does not work on most of libcore</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209223185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/209223185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#209223185">(Sep 06 2020 at 12:24)</a>:</h4>
<p>libcore contains a lot of modules with <code>#[cfg(not(test))]</code> on them, but r-a analysis seems to happen with <code>cfg(test)</code> enabled, breaking it on most of libcore.</p>
<p>Is there any way around this? I'm assuming it's on by default to allow analysis in test modules</p>



<a name="209223454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/209223454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#209223454">(Sep 06 2020 at 12:31)</a>:</h4>
<p>Luckily these cfgs don't seem to be actually necessary, so I can remove them for now</p>



<a name="209223468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/209223468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#209223468">(Sep 06 2020 at 12:31)</a>:</h4>
<p>In my ideal world rust-analyzer would magically work with all cfg possibilities at the same time, but that's probably going to remain a pipe dream for the foreseeable future :)</p>



<a name="209223569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/209223569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#209223569">(Sep 06 2020 at 12:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore/near/209223454">said</a>:</p>
<blockquote>
<p>Luckily these cfgs don't seem to be actually necessary, so I can remove them for now</p>
</blockquote>
<p>They are necessary when testing I think, as otherwise things would conflict with the libcore included through libtest.</p>



<a name="209223824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/209223824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#209223824">(Sep 06 2020 at 12:39)</a>:</h4>
<p>Doesn't look like it. The comments point to <a href="https://github.com/rust-lang/rust/issues/65860">https://github.com/rust-lang/rust/issues/65860</a>, which hasn't been done yet.</p>



<a name="209229082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/209229082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#209229082">(Sep 06 2020 at 15:08)</a>:</h4>
<p>Opened <a href="https://github.com/rust-lang/rust/pull/76409">https://github.com/rust-lang/rust/pull/76409</a>, let's see if that works</p>



<a name="210070937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20does%20not%20work%20on%20most%20of%20libcore/near/210070937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> woody77 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20does.20not.20work.20on.20most.20of.20libcore.html#210070937">(Sep 14 2020 at 22:34)</a>:</h4>
<p>rust-analyzer, with a Cargo.toml project, will set <code>test</code> when it's processing sources (but not when processing the stdlib itself (as an injected dependency of the project). </p>
<p>You might have an easier time with RA in the stdlib if you generated a rust-project.json for it (where you can be really explicit about all of the folders and features).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>